window.onload = function () {
  let oInputs = document.querySelectorAll("input");
  oInputs[6].onclick = function () {
    let username = oInputs[0].value;
    let password = oInputs[3].value;
    let regAPI = "http://jx.xuzhixiang.top/ap/api/reg.php";
    axios
      .get(regAPI, {
        params: {
          username: username,
          password: password,
        },
      })
      .then(function (res) {
        // 请求成功
        alert(res.data.msg);
        if (res.data.code == 1) {
          location.href = "login.html";
        }
      })
      .catch(function (err) {
        // 请求失败
        console.log(err);
      });
  };
};
